package com.lz.rabbitmq.direct;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 生产者
 */
@Configuration
public class ProducerDirect {

    @Resource
    private RabbitTemplate rabbitTemplate;

    /**
     * 发送消息
     */

    public void send() {
        String msg = "hello lz";
        rabbitTemplate.convertAndSend("directExchange", "direct", msg);
    }
}
